package com.qiangqiang.controller;

import com.qiangqiang.dto.SanitationDTO;
import com.qiangqiang.service.SanitationService;
import com.qiangqiang.util.ResultVOUtil;
import com.qiangqiang.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by q on 2018/2/20.
 */
@RestController
@RequestMapping("/sanitation")
public class SantitationService {

    @Autowired
    private SanitationService sanitationService;

    @RequestMapping("/findAll")
    public ResultVO<List<SanitationDTO>> findAllByDid(@RequestParam("dId") String dId){
        return ResultVOUtil.success(sanitationService.findAllByDid(dId));
    }

    @RequestMapping("/add")
    public ResultVO addSanitationRecord(@RequestParam("dId") String dId,
                                        @RequestParam("level") Integer level){
        sanitationService.addSanitationRecord(dId,level);
        return ResultVOUtil.success();
    }
}
